package com.example.controller;

import com.example.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @program: spring-boot-demo
 * @description: RedisController
 * @author: JackDong.ch
 * @create: 2018-04-13 16:27
 **/
@RestController
public class RedisController {
    @Autowired
    private RedisService redisService ;


    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public String demoTest(){
        String uuid = UUID.randomUUID().toString();
        if(redisService.set(uuid,"value22222")){
            return redisService.get(uuid).toString();
        }
        redisService.set(uuid,"value22222");
        return  "1111111";

    }

    @RequestMapping(value = "/get",method = RequestMethod.GET)
    public String getValue(){
        String s = "11111111111111111111111";//redisService.get("1").toString();
        System.out.print(s);
        return s;
    }
}
